package com.sun.kafka.thread;

import com.sun.kafka.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;

import java.util.List;

@Slf4j
public class MessageTask implements Runnable {

    private List<ConsumerRecord<String, String>> records;

    private MessageService messageService;

    public MessageTask(List<ConsumerRecord<String, String>> records, MessageService messageService) {
        this.records = records;
        this.messageService = messageService;
    }

    @Override
    public void run() {
        messageService.process(records);
    }

}
